package com.lenovo.translatetext;

import android.Manifest;
import android.content.Context;

import pub.devrel.easypermissions.EasyPermissions;

/**
 * @ProjectName: Translation
 * @Package: com.lenovo.translatetext
 * @ClassName: Permission
 * @Description: Permission类作用描述
 * @Author: kgzhou
 * @CreateDate: 2019/4/29 11:23
 * @UpdateUser: kgzhou
 * @UpdateDate: 2019/4/29 11:23
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class Permission {
    public  static final int RC_READ_STORAGE_PERM = 123;
    public  static final int RC_WRITE_STORAGE_PERM = 124;
    /**
     * 判断是否授予了读取储存的权限
     * @param context
     * @return
     */
    public static boolean hasReadStoragePermission(Context context) {
        return EasyPermissions.hasPermissions(context, Manifest.permission.READ_EXTERNAL_STORAGE);
    }

    /**
     * 判断是否授予了攥写储存的权限
     * @param context
     * @return
     */
    public static boolean hasWriteStoragePermission(Context context) {
        return EasyPermissions.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE);
    }
}
